home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / vbcc-68k-src / machines / amiga68k / libsrc / amigalib / createio.c < prev    next >
C/C++ Source or Header  |  1999-01-01  |  1KB  |  46 lines

  1. #include <exec/io.h>
  2. #include <exec/memory.h>
  3. #include <clib/alib_protos.h>
  4. #include <proto/exec.h>
  5.  
  6. struct IORequest *CreateExtIO(struct MsgPort *port,long iosize)
  7. {
  8.   struct IORequest *ioreq=NULL;
  9.  
  10.   if (port && (ioreq=AllocMem(iosize,MEMF_CLEAR|MEMF_PUBLIC)))
  11.   {
  12.     ioreq->io_Message.mn_Node.ln_Type=NT_MESSAGE;
  13.     ioreq->io_Message.mn_ReplyPort=port;
  14.     ioreq->io_Message.mn_Length=iosize;
  15.   }
  16.   return ioreq;
  17. }
  18.  
  19. struct IOStdReq *CreateStdIO(struct MsgPort *port)
  20. {
  21.   return (struct IOStdReq *)CreateExtIO(port,sizeof(struct IOStdReq));
  22. }
  23.  
  24. void DeleteExtIO(struct IORequest *ioreq)
  25. {
  26.   int i;
  27.  
  28.   i=-1;
  29.   ioreq->io_Message.mn_Node.ln_Type=i;
  30.   ioreq->io_Device=(struct Device *)i;
  31.   ioreq->io_Unit=(struct Unit *)i;
  32.   FreeMem(ioreq,ioreq->io_Message.mn_Length);
  33. }
  34.  
  35. void DeleteStdIO(struct IOStdReq *io)
  36. {
  37.   int i;struct IORequest *ioreq=(struct IORequest *)io;
  38.  
  39.   i=-1;
  40.   ioreq->io_Message.mn_Node.ln_Type=i;
  41.   ioreq->io_Device=(struct Device *)i;
  42.   ioreq->io_Unit=(struct Unit *)i;
  43.   FreeMem(ioreq,ioreq->io_Message.mn_Length);
  44. }
  45.  
  46.